<extend name="Public:mainbase" />
<block name="content">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/css/dhtmlxtree.css"/>
<script language="javascript" src="__PUBLIC__/js/member.js?{:time()}"></script>  
<script language="javascript" src="__PUBLIC__/js/Validform_v5.3.2_min.js?{:time()}"></script> 
<link rel="stylesheet" href="__PUBLIC__/css/editArticle.css">
<style type="text/css">
	.Validform_checktip{line-height: 34px}
	
</style> 
<!--  内容列表   -->
<form name="form2" method="post">
<table width="98%" class="table table-bordered table-condensed "  align="center">
<tr bgcolor="#E7E7E7" >
	<td height="28" background="__PUBLIC__/images/tbg.gif" style="padding-left:10px;">
	◆ 文稿编辑 &nbsp;&nbsp;&nbsp;&nbsp;<!--<button type="button" class="btn btn-xs btn-warning" data-toggle="modal" data-target=".newarticlebox"><i class="glyphicon glyphicon-plus"></i> 添加文稿</button>-->
	</td>
</tr>
<tr align="center" bgcolor="#ffffff" height="25">
	<td>		
		<div class="container-fluid">
			<div class="row">
				<div class="col-xs-3">
						<div class="left">
						<div class="indexpic-box">
	                        <div class="indexpic" style="font-size:0;">
	                            <img style="max-width:160px;max-height:160px;"  title="索引图" id="indexpic_url" src="{:C('UPLOAD_HOST')}{$article.indexpic|default='..__PUBLIC__/images/suoyin-default.png'}">
	                        </div>
	                        <span class="indexpic-suoyin <notempty name="article.indexpic"> indexpic-suoyin-current</notempty>"></span>
	                    </div>

	                    <div class="right-fix-box">
							<div class="form-cioption form-right" style="min-height:500px;">
								<!-- <div class="form-dioption-brief form-dioption-item">
													                <div style="display:none;">
													                	<textarea name="brief" id="brief" class="brief " placeholder="添加文稿摘要" _value="添加文稿摘要"></textarea>
													                </div>
													                <div class="wordcount-tip" style="position: absolute; color:#fff;font-size: 12px; text-align: center; min-width: 50px; z-index: 100; right:15px;top:-11px; display:none;padding: 2px 3px; border-radius: 2px;  background: rgb(107, 164, 235);"></div>
													                <div contenteditable="true" id="brief-clone" data-left="-35px" data-top="-19px" class="my-placeholder need-word-count" target="brief" placeholder="添加文稿摘要" style="overflow-y: hidden; height: 94px;">添加文稿摘要</div>
												                </div>
												                <div class="form-dioption-subtitle form-dioption-item">
												                    <input name="subtitle" id="subtitle" type="text" value="" style="display:none;">
												                    <div contenteditable="true" id="subtitle-clone" class="my-placeholder" target="subtitle" placeholder="设置副题" preval="副题：">设置副题</div>
												                </div> -->
				                <div class="form-dioption-author form-dioption-item">
				                    
				                    <div  id="author-clone" class="my-placeholder" >发稿人： {$article.realname}</div>
				                </div>
				                 <div class="form-dioption-author form-dioption-item">
				                    
				                    <div  id="author-clone" class="my-placeholder" >联合记者： {$article.authorlist}</div>
				                </div>
				                <!-- <div class="form-dioption-source form-dioption-item">
				                    <input name="source" id="source" type="text" value="" style="display:none;">
				                    <div contenteditable="true" id="source-clone" class="my-placeholder" target="source" placeholder="来源" preval="来源：">来源</div>
				                </div> -->
							</div>
						</div>
						</div>
				</div>
				<div class="col-xs-9">
					<div class="form-dioption-title form-dioption-item">
						<!-- <textarea name="title" _value="添加文稿标题" id="title" class="title " placeholder="添加文稿标题"></textarea> -->
						<div class="wordcount-tip" style="position: absolute; color: rgb(255, 255, 255); font-size: 12px; text-align: center; min-width: 50px; z-index: 100;  padding: 2px 3px; border-radius: 2px; display: none; background: rgb(107, 164, 235); right:15px;top:-11px; "></div>
							<input name="title" _value="{$article['title']}" class="title   need-word-count" placeholder="添加文稿标题" value="{$article['title']}" title="{$article['title']}">
						
						<div class="color-selector clearfix">
							<span class="form-title-weight"></span>
							<span class="form-title-italic"></span>
							<span class="form-title-color" style="background-color: rgb(0, 0, 0);"><div class="title-color-box"><div><span style="background:#fff" data-color="#fff"></span><span style="background:#000" data-color="#000"></span><span style="background:#eeece0" data-color="#eeece0"></span><span style="background:#1c477c" data-color="#1c477c"></span><span style="background:#4e80bf" data-color="#4e80bf"></span><span style="background:#c24f4a" data-color="#c24f4a"></span><span style="background:#99bd53" data-color="#99bd53"></span><span style="background:#8162a5" data-color="#8162a5"></span><span style="background:#46abc7" data-color="#46abc7"></span><span style="background:#f99639" data-color="#f99639"></span></div><div><span style="background:#f2f2f2" data-color="#f2f2f2"></span><span style="background:#7f7f7f" data-color="#7f7f7f"></span><span style="background:#dcdac3" data-color="#dcdac3"></span><span style="background:#c4d8f1" data-color="#c4d8f1"></span><span style="background:#dae6f2" data-color="#dae6f2"></span><span style="background:#f2ddda" data-color="#f2ddda"></span><span style="background:#ecf2dd" data-color="#ecf2dd"></span><span style="background:#e5dfeb" data-color="#e5dfeb"></span><span style="background:#dbeef5" data-color="#dbeef5"></span><span style="background:#fdead9" data-color="#fdead9"></span><span style="background:#d8d8d8" data-color="#d8d8d8"></span><span style="background:#595959" data-color="#595959"></span><span style="background:#c5bd96" data-color="#c5bd96"></span><span style="background:#8cb2e3" data-color="#8cb2e3"></span><span style="background:#b7cbe6" data-color="#b7cbe6"></span><span style="background:#e6b9b6" data-color="#e6b9b6"></span><span style="background:#d8e5ba" data-color="#d8e5ba"></span><span style="background:#cdc0da" data-color="#cdc0da"></span><span style="background:#b7ddea" data-color="#b7ddea"></span><span style="background:#fdd7b3" data-color="#fdd7b3"></span><span style="background:#bfbfbf" data-color="#bfbfbf"></span><span style="background:#3f3f3f" data-color="#3f3f3f"></span><span style="background:#948a4f" data-color="#948a4f"></span><span style="background:#518bd5" data-color="#518bd5"></span><span style="background:#95b3d9" data-color="#95b3d9"></span><span style="background:#da9492" data-color="#da9492"></span><span style="background:#c3d798" data-color="#c3d798"></span><span style="background:#b2a2c9" data-color="#b2a2c9"></span><span style="background:#8fcddc" data-color="#8fcddc"></span><span style="background:#fcc08c" data-color="#fcc08c"></span><span style="background:#a5a5a5" data-color="#a5a5a5"></span><span style="background:#262626" data-color="#262626"></span><span style="background:#494427" data-color="#494427"></span><span style="background:#15355e" data-color="#15355e"></span><span style="background:#345f94" data-color="#345f94"></span><span style="background:#973630" data-color="#973630"></span><span style="background:#759235" data-color="#759235"></span><span style="background:#60487c" data-color="#60487c"></span><span style="background:#2d859d" data-color="#2d859d"></span><span style="background:#e56c01" data-color="#e56c01"></span><span style="background:#7f7f7f" data-color="#7f7f7f"></span><span style="background:#0c0c0c" data-color="#0c0c0c"></span><span style="background:#1d1b0f" data-color="#1d1b0f"></span><span style="background:#0d223f" data-color="#0d223f"></span><span style="background:#223f61" data-color="#223f61"></span><span style="background:#642422" data-color="#642422"></span><span style="background:#4f6125" data-color="#4f6125"></span><span style="background:#3e3051" data-color="#3e3051"></span><span style="background:#1d5868" data-color="#1d5868"></span><span style="background:#984800" data-color="#984800"></span></div><div><span style="background:#c20000" data-color="#c20000"></span><span style="background:#fe0000" data-color="#fe0000"></span><span style="background:#ffc100" data-color="#ffc100"></span><span style="background:#ff0" data-color="#ff0"></span><span style="background:#8fd245" data-color="#8fd245"></span><span style="background:#00b24c" data-color="#00b24c"></span><span style="background:#00aef3" data-color="#00aef3"></span><span style="background:#006ec3" data-color="#006ec3"></span><span style="background:#011e62" data-color="#011e62"></span><span style="background:#712aa2" data-color="#712aa2"></span></div></div></span>
							
						</div>
						<div id="word-count">
						</div>
						<input name="tcolor" type="hidden" value="#000" id="tcolor">
						<input name="isbold" type="hidden" value="0" id="isbold">
						<input name="isitalic" type="hidden" value="0" id="isitalic">
						<input name="weight" value="0" id="weight" type="hidden">
					</div>

					<div class="content-editor">
						<div>
		                   <!--  <script type="text/plain" id="content"></script> -->
		                   <div>
		                   		<div>
		                   		{$article.content}
		                   	</div>
		                   		<volist name='attach' id='attachV'>
		                   		<eq name="attachV.type" value="image">
								<img src="{:C('UPLOAD_HOST')}{$attachV.filepath}{$attachV.filename}" width="45%" alt="">
								</eq>
								<eq name="attachV.type" value="video">
									<a href="{:C('UPLOAD_HOST')}{$attachV.filepath}{$attachV.filename}">下载视频</a>
								</eq>
		                   		</volist>
		                   </div>
		                    <div class="con-split"></div>
		                </div>
					</div>
				</div>
			</div>
		</div>
	</td>
</tr>
<tr align="center" bgcolor="#FBFCE2" height="25">
	<td></td>
</tr>
</table>

</form>
<input type="file" id="indexpicupload" style='display: none'>

<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/js/lang/zh-cn/zh-cn.js"></script>
<script>
/*var ue = UE.getEditor('content', {
		toolbars: [
		    ['source', '|','undo', 'redo','|','bold', 'italic', 'underline', 'removeformat','indent','forecolor', '|','fontsize','insertorderedlist','justifyleft', 'justifyright','justifycenter','justifyjustify', '|']
		],
		// imageUrl: '{:U("Article/uploadImage")}',
		// imagePath: '<?= UPLOAD_PATH ?>'
		serverUrl: '{:U("Admin/Article/getImageUploadConfig")}?aid=' + $('.editarticle').data('aid'),
		wordCount :false,
		autoHeightEnabled :false,

		initialFrameHeight:530 //初始化编辑器高度，默认320
	 });*/

/*$(".indexpic").on('click',function(){
	$("#indexpicupload").click();	
})*/

$("#indexpicupload").on('change',function(){
	if(typeof form!='undefined'){
		delete form;
	}
	if($(this).val()!=''){
		var form=new FormData();
		form.append('indexFile',$(this)[0].files[0])
		$.ajax({
			cache:false,
			type:'post',
			url:'{:U("ajaxUploadImage")}',
			data: form,
			dataType:'json',
			processData: false,
			contentType: false,
			success:function(data){
				if(data.status==1){
					$('#indexpic_url').attr('src','/Uploads/'+data.info.savepath+data.info.savename)
					$('.indexpic-suoyin').addClass('indexpic-suoyin-current');
				}
			},
			complete:function(){
				delete form;
			}
		})
	}
})

$('.my-placeholder').on({
	'focus':function(){
			$(this).addClass('on');
			if($(this).text()==$(this).attr('placeholder')){
				$(this).text("");
			}else{
				$(this).select();
			}
	},
	'blur':function(){
			$(this).removeClass('on');
			if($(this).text()==''){
				$(this).text($(this).attr('placeholder'));
			}
	}
})
$(".need-word-count").on({
	'keyup':function(){
		if($(this).is("input")){
			var strlen=$(this).val().length;
		}else{
			var strlen=$(this).text().length;
		}
		
		console.log(strlen);
		if(strlen>0){
			$(this).prev('.wordcount-tip').text(strlen+'字').show();
		}else{
			$(this).prev('.wordcount-tip').empty().hide();
		}
	}
})

$(".form-title-color").click(function(){	
	$(this).find('.title-color-box').show();
})

$(".color-selector").mouseleave(function(){
	$(this).find('.title-color-box').hide();
})

$('.title-color-box').on('click','span',function(){
	var color=$(this).css('background-color')
	$(".form-title-color").css('background-color',color);
	$('.title').css({'color':color,'border-bottom-color':color});
	$('#tcolor').val(color);
	$('.title-color-box').hide();
})
$('.form-title-weight').click(function(){
	if($('.title').css('font-weight')=='bold'){
		$('.title').css('font-weight','normal');
		$(this).removeAttr('style');
		$('#isbold').val(0);

	}else{
		$('.title').css('font-weight','bold');
		$(this).css('background','url(__PUBLIC__/images/title-weight-selected.png)')
		$('#isbold').val(1);
	}
})

$('.form-title-italic').click(function(){
	if($('.title').css('font-style')=='italic'){
		$('.title').css('font-style','normal');
		$(this).removeAttr('style');
		$('#isitalic').val(0);
	}else{
		$('.title').css('font-style','italic');
		$(this).css('background','url(__PUBLIC__/images/title-italic-selected.png)')
		$('#isitalic').val(1);
	}
})

</script>
<!-- 
<style type="text/css">
.editarticlebox { z-index: 900 !important; }
.modal-backdrop	{z-index: 800 !important; }
</style>
<script type="text/javascript">


	 

	$('.delarticle').click(function(){
		if(confirm('是否确定删除此用户？')){
			var obj=this;
			$.get('{:U("ajaxDelArticle")}?id='+$(obj).data('aid'),function(data){
				if(data.status==1){
					$(obj).parents('tr').remove();
				}
			})
		}
	})

	$('#deluserall').click(function(){
		if(confirm('是否确定删除？')){
			var id=$('[name=aid]:checked').map(function(){
				return $(this).val();
			}).get().join()
			
			$.get('{:U("ajaxDelArticle")}?id='+id,function(data){
				if(data.status==1){
					$('[name=aid]:checked').parents('tr').remove();
				}
			})
		}
	})

	$('#newarticlebox').on('show.bs.modal', function (e) {
  		$('#newarticlebox form').get(0).reset();
  		$('#newarticlebox .Validform_checktip').empty().attr('class','Validform_checktip');
  		$('.Validform_error').removeClass('Validform_error');
	})
	$.ajaxSetup({cache:false})
	$('.editarticle').click(function(){
		$('#editarticlebox form').get(0).reset();
		$.get("{:U('ajaxGetArticle')}?aid="+$(this).data('aid'),function(data){
  			if(data!=0){
  				$("#editarticlebox [name=aid]").val(data.id);
  				$("#editarticlebox [name=title]").val(data.title);
  				$("#editarticlebox [name=author]").val(data.author);
  				$("#editarticlebox [name=subtitle]").val(data.subtitle);
  				$("#editarticlebox [name=brief]").val(data.brief);
  				$("#editarticlebox [name=keywords]").val(data.keywords);	
  				var content = data.html_content ? data.html_content : data.content;
  				ue.setContent(content);		
  			}
  		})
  		$('#editarticlebox .Validform_checktip').empty().attr('class','Validform_checktip');
  		$('.Validform_error').removeClass('Validform_error');
		$('#editarticlebox').modal('show');
	})

	$("form").Validform({
		tiptype:2,
		showAllError:true,
		datatype:{
			"zh2-30":/^[\u4E00-\u9FA5\uf900-\ufa2d]{2,30}$/
		},
	})

	function geturl($url){
		$a=$url.split('?');
		return $a[0];
	}

	$('.push').on('click', function () {
		$.get('{:U('Mapi/Article/pushArticle')}?articleId=' + $(this).data('aid'), function (data) {
			if(data.resultCode == 0) {
				alert('推送成功');
			} else {
				alert(data.message);
			}
		});
	});

</script> -->

</block>